Repository navigation
test: require a real MCP call and cleanup during evaluation - #7474
Open
astrogilda wants to merge 7 commits into
Open
astrogilda wants to merge 7 commits into
astrogilda wants to merge 7 commits into
Conversation
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 12, 2026
`test_mcp_stdio_agent_no_runtime_error` in `test_local_eval_service.py` spawned an unpinned `npx -y @modelcontextprotocol/server-filesystem` process and caught every exception inside `perform_inference()`, allowing a failed MCP server startup, failed inference, or unfinished cleanup to pass as a successful test. Replace it in `test_local_eval_service.py` with tests against a local finite Python stdio MCP server that verify `LocalEvalService.perform_inference()` executes the MCP tool call, receives the native tool result, completes model inference, and closes the MCP server cleanly without cleanup warnings or errors. Additional tests verify that toolset load failures log an error while inference succeeds without the toolset's tools, MCP tool errors (`isError=True`) are forwarded to the model while inference succeeds, model errors return `InferenceStatus.FAILURE` and close the toolset, and toolset close errors are logged while inference succeeds. Pull Request: #7474 PiperOrigin-RevId: 997703943
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The old MCP evaluation test catches every exception and still passes, and starts an unpinned
npxserver. A failed server, failed inference or unfinished cleanup can therefore look like a successful MCP check.Replace it with a finite Python stdio peer and consume the complete native evaluation. Require the real tool call, native result, successful inference, a terminated child and released session. Controls refuse missing tools, model failure,
isError, and failed cleanup before or after resource release.Checked head
4d699befover current main3d11f9fe. Python 3.11 and 3.14 each pass 168 affected evaluation/session checks with MCP 2.3.0, plus 39 native/evaluation checks with MCP 1.30.0, with no skips. Pyink, isort, compliance and dependency checks pass.